package com.z.platform.actingModel;

import java.lang.reflect.Proxy;
import java.util.Arrays;
import java.util.function.IntFunction;

public class ProxyFactory {
    public static <T> T getProxy(Class<T> clazz){
        DemoProxy demoProxy = null;
        try {
            T newInstance = clazz.newInstance();
             demoProxy =new DemoProxy();
            demoProxy.setTarget(newInstance);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return (T)Proxy.newProxyInstance(clazz.getClassLoader(), clazz.getInterfaces(), demoProxy);
    }

}
